@import "../common/var";
@mixin button-plain($color, $type) {
  color: $color;
  //background: mix($--color-white, $color, 90%);
  //border-color: mix($--color-white, $color, 60%);
  @if $type == primary {
    background-color: $--button-primary-background-color-plain;
    border-color: $--button-primary-border-color-plain;
  } @else if $type == success {
    background-color: $--button-success-background-color-plain;
    border-color: $--button-success-border-color-plain;
  } @else if $type == warning {
    background-color: $--button-warning-background-color-plain;
    border-color: $--button-warning-border-color-plain;
  } @else if $type == info {
    background-color: $--button-info-background-color-plain;
    border-color: $--button-info-border-color-plain;
  } @else {
    background-color: $--button-danger-background-color-plain;
    border-color: $--button-danger-border-color-plain;
  }

  &:hover,
  &:focus {
    background: $color;
    border-color: $color;
    color: $--color-white;
  }

  &:active {
    //background: mix($--color-black, $color, $--button-active-shade-percent);
    //border-color: mix($--color-black, $color, $--button-active-shade-percent);
    @if $type == primary {
      background-color: $--button-primary-background-color-active;
      border-color: $--button-primary-border-color-active;
    } @else if $type == success {
      background-color: $--button-success-background-color-active;
      border-color: $--button-success-border-color-active;
    } @else if $type == warning {
      background-color: $--button-warning-background-color-active;
      border-color: $--button-warning-border-color-active;
    } @else if $type == info {
      background-color: $--button-info-background-color-active;
      border-color: $--button-info-border-color-active;
    } @else {
      background-color: $--button-danger-background-color-active;
      border-color: $--button-danger-border-color-active;
    }
    color: $--color-white;
    outline: none;
  }

  &.is-disabled {
    &,
    &:hover,
    &:focus,
    &:active {
      color: $color;
      //color: mix($--color-white, $color, 40%);
      //background-color: mix($--color-white, $color, 90%);
      //border-color: mix($--color-white, $color, 80%);
      @if $type == primary {
        background-color: $--button-primary-background-color-plain-disabled;
        border-color: $--button-primary-border-color-plain-disabled;
      } @else if $type == success {
        background-color: $--button-success-background-color-plain-disabled;
        border-color: $--button-success-border-color-plain-disabled;
      } @else if $type == warning {
        background-color: $--button-warning-background-color-plain-disabled;
        border-color: $--button-warning-border-color-plain-disabled;
      } @else if $type == info {
        background-color: $--button-info-background-color-plain-disabled;
        border-color: $--button-info-border-color-plain-disabled;
      } @else {
        background-color: $--button-danger-background-color-plain-disabled;
        border-color: $--button-danger-border-color-plain-disabled;
      }
    }
  }
}

@mixin button-variant($color, $background-color, $border-color, $type) {
  color: $color;
  background-color: $background-color;
  border-color: $border-color;

  &:hover,
  &:focus {
    //background: mix($--color-white, $background-color, $--button-hover-tint-percent);
    //border-color: mix($--color-white, $border-color, $--button-hover-tint-percent);
    @if $type == primary {
      background-color: $--button-primary-background-color-hover;
      border-color: $--button-primary-border-color-hover;
    } @else if $type == success {
      background-color: $--button-success-background-color-hover;
      border-color: $--button-success-border-color-hover;
    } @else if $type == warning {
      background-color: $--button-warning-background-color-hover;
      border-color: $--button-warning-border-color-hover;
    } @else if $type == info {
      background-color: $--button-info-background-color-hover;
      border-color: $--button-info-border-color-hover;
    } @else {
      background-color: $--button-danger-background-color-hover;
      border-color: $--button-danger-border-color-hover;
    }
    color: $color;
  }

  &:active {
    //background: mix($--color-black, $background-color, $--button-active-shade-percent);
    //border-color: mix($--color-black, $border-color, $--button-active-shade-percent);
    @if $type == primary {
      background-color: $--button-primary-background-color-active;
      border-color: $--button-primary-border-color-active;
    } @else if $type == success {
      background-color: $--button-success-background-color-active;
      border-color: $--button-success-border-color-active;
    } @else if $type == warning {
      background-color: $--button-warning-background-color-active;
      border-color: $--button-warning-border-color-active;
    } @else if $type == info {
      background-color: $--button-info-background-color-active;
      border-color: $--button-info-border-color-active;
    } @else {
      background-color: $--button-danger-background-color-active;
      border-color: $--button-danger-border-color-active;
    }
    color: $color;
    outline: none;
  }

  &.is-active {
    //background: mix($--color-black, $background-color, $--button-active-shade-percent);
    //border-color: mix($--color-black, $border-color, $--button-active-shade-percent);
    @if $type == primary {
      background-color: $--button-primary-background-color-active;
      border-color: $--button-primary-border-color-active;
    } @else if $type == success {
      background-color: $--button-success-background-color-active;
      border-color: $--button-success-border-color-active;
    } @else if $type == warning {
      background-color: $--button-warning-background-color-active;
      border-color: $--button-warning-border-color-active;
    } @else if $type == info {
      background-color: $--button-info-background-color-active;
      border-color: $--button-info-border-color-active;
    } @else {
      background-color: $--button-danger-background-color-active;
      border-color: $--button-danger-border-color-active;
    }
    color: $color;
  }

  &.is-disabled {
    &,
    &:hover,
    &:focus,
    &:active {
      color: $--color-white;
      //background-color: mix($background-color, $--color-white);
      //border-color: mix($border-color, $--color-white);
      @if $type == primary {
        background-color: $--button-primary-background-color-disabled;
        border-color: $--button-primary-border-color-disabled;
      } @else if $type == success {
        background-color: $--button-success-background-color-disabled;
        border-color: $--button-success-border-color-disabled;
      } @else if $type == warning {
        background-color: $--button-warning-background-color-disabled;
        border-color: $--button-warning-border-color-disabled;
      } @else if $type == info {
        background-color: $--button-info-background-color-disabled;
        border-color: $--button-info-border-color-disabled;
      } @else {
        background-color: $--button-danger-background-color-disabled;
        border-color: $--button-danger-border-color-disabled;
      }
    }
  }

  &.is-plain {
    @include button-plain($background-color, $type);
  }
}

@mixin button-size($padding-vertical, $padding-horizontal, $font-size, $border-radius) {
  padding: $padding-vertical $padding-horizontal;
  font-size: $font-size;
  border-radius: $border-radius;
  &.is-round {
    padding: $padding-vertical $padding-horizontal;
  }
}
